Skip to content

Run broker-backed transport tests in CI - #82

Closed
christopherread wants to merge 5 commits into
masterfrom
ci/broker-tests
Closed

christopherread wants to merge 5 commits into
masterfrom
ci/broker-tests

Conversation

@christopherread

@christopherread christopherread commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Fixes #74 for RabbitMQ, NATS and Kafka. The NetMQ tests stay out for now: in CI they lose their first messages (ZeroMQ slow joiner), which is tracked in #102.

Updated after #101: the broker step uses the xUnit v3 / Microsoft.Testing.Platform syntax (dotnet test --project … -- --filter-trait "Category=Explicit"), and runs before the unit-test step so this branch doesn't touch the lines #101 changed. It merges cleanly, with no merge commits (GitVersion 6 crashes on those).

Changes

  • Service containers: the CI job now starts rabbitmq:4.4-alpine, nats:2.15 and apache/kafka:4.4.0.
    • RabbitMQ's health check uses rabbitmq-diagnostics check_port_connectivity, because ping reported ready before AMQP connections were accepted.
    • Kafka gets a full single-node KRaft configuration. Setting any KAFKA_* variable replaces the image's defaults, so the first attempt failed to start.
  • New "Prepare Kafka" step: creates test-topic-3 and runs a short warm-up consumer group, so Kafka has created its internal __consumer_offsets topic (1 partition here) before the tests.
    • The Obvs Kafka consumer starts at the latest offset, and Subscribe returns before partitions are assigned.
    • Without the warm-up, the test's messages went by while that topic was still being created, and the test received nothing.
    • The broker also skips its usual 3-second wait before assigning a new consumer group (KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0).
  • New "Test transports against brokers" step: runs the Category=Explicit tests in Obvs.RabbitMQ.Tests, Obvs.NATS.Tests and Obvs.Kafka.Tests. The existing unit test step is unchanged.
  • Configurable addresses: the NATS and Kafka tests read NATS_URL and KAFKA_BOOTSTRAP_SERVERS (defaulting to localhost) instead of hard-coded Docker Machine addresses, the same way RabbitMQ uses RABBITMQ_URI since Upgrade RabbitMQ.Client 5.0.1 to 7.2.2 #69.

Results (CI)

Transport Tests Result
RabbitMQ (RabbitMQ.Client 7.2.2) 3 ✅ passed
NATS (NATS.Client 1.1.8) 2 ✅ passed
Kafka (Confluent.Kafka 2.16.0) 1 ✅ passed, all 3 messages received

This is the first real-broker check of the Kafka 2.x and NATS 1.x upgrades from #65. Locally, the RabbitMQ tests also pass with the same filter and env var.

Not covered: ActiveMQ, because its one broker test is commented out.

Worth a separate issue: the Kafka consumer-start race affects real users too. A message published straight after subscribing can be missed until partitions are assigned. A fix would make Subscribe wait for assignment.

🤖 Generated with Claude Code

christopherread and others added 3 commits October 24, 2026 23:41
Start RabbitMQ, NATS and Kafka as service containers and run each
transport's Category=Explicit tests against them in a separate step.
The NATS and Kafka tests now read NATS_URL and KAFKA_BOOTSTRAP_SERVERS
(defaulting to localhost) instead of hard-coded Docker addresses, like
the RabbitMQ tests' RABBITMQ_URI.

Part of #74; the NetMQ tests join once #80 is merged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS alone replaced the
image defaults and the broker failed to start (missing process.roles).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Kafka test consumer starts at the latest offset and Subscribe returns
before partitions are assigned, so on a fresh broker it missed the
messages while __consumer_offsets was being created. Use one offsets
partition and run a warm-up consumer group first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
christopherread and others added 2 commits October 25, 2026 00:06
Master now runs tests on Microsoft.Testing.Platform (#101), so use
--project and --filter-trait. The NetMQ tests no longer clash over ports
(#80), so run them too. The broker steps now come before the unit test
step, so this branch no longer edits the lines master changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They lose the first messages on CI runners (ZeroMQ slow joiner): the
publisher socket is created on first publish and sends before
subscribers have connected. Tracked separately.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@christopherread

Copy link
Copy Markdown
Owner Author

Combined into #104, which includes this change as its own commit.

christopherread added a commit that referenced this pull request Oct 25, 2026
…h and NATS.Net ports, Kafka subscribe fix (#104)

Fixes #74, fixes #76, fixes #77, fixes #78, fixes #79, fixes #103.

Combines #82, #83, #96, #98 and #99, plus the Kafka subscribe fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@christopherread
christopherread deleted the ci/broker-tests branch October 25, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run broker-backed transport tests in CI

1 participant